<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Catalago de Obras - Grupo 25: Referência do Arquivo remove.h</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Gerado por Doxygen 1.5.5 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Página&nbsp;Principal</span></a></li>
      <li><a href="annotated.html"><span>Estruturas&nbsp;de&nbsp;Dados</span></a></li>
      <li class="current"><a href="files.html"><span>Arquivos</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Referência do Arquivo remove.h</h1><code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;stdio_ext.h&gt;</code><br>
<code>#include &quot;<a class="el" href="consulta_8h-source.html">consulta.h</a>&quot;</code><br>

<p>
<div class="dynheader">
Gráfico de dependência de inclusões para remove.h:</div>
<div class="dynsection">
<p><center><img src="remove_8h__incl.png" border="0" usemap="#remove.h_map" alt=""></center>
<map name="remove.h_map">
<area shape="rect" href="consulta_8h.html" title="consulta.h" alt="" coords="180,84,271,111"></map>
</div>

<p>
<div class="dynheader">
Este grafo mostra quais arquivos estão direta ou indiretamente relacionados com este arquivo:</div>
<div class="dynsection">
<p><center><img src="remove_8h__dep__incl.png" border="0" usemap="#remove.hdep_map" alt=""></center>
<map name="remove.hdep_map">
<area shape="rect" href="inserir_8h.html" title="inserir.h" alt="" coords="116,84,188,111"><area shape="rect" href="remove_8c.html" title="remove.c" alt="" coords="212,84,297,111"><area shape="rect" href="consulta_8c.html" title="consulta.c" alt="" coords="5,161,96,188"><area shape="rect" href="keys_8h.html" title="keys.h" alt="" coords="120,161,184,188"><area shape="rect" href="inserir_8c.html" title="inserir.c" alt="" coords="208,161,280,188"><area shape="rect" href="dados_8c.html" title="dados.c" alt="" coords="69,239,141,265"><area shape="rect" href="keys_8c.html" title="keys.c" alt="" coords="165,239,229,265"></map>
</div>

<p>
<a href="remove_8h-source.html">Vá para o código-fonte deste arquivo.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Definições e Macros</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="remove_8h.html#188f1f2349eb5bc93fad6bfd21729574">FIM_AVAIL</a>&nbsp;&nbsp;&nbsp;-1</td></tr>

<tr><td colspan="2"><br><h2>Funções</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="remove_8h.html#81d2780fd2ab9f3eabe0faf2eeff5022">cria_avail</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="remove_8h.html#9bbf12ea3c272f4e62cf440eae0acb09">remocao</a> (<a class="el" href="structNo__PK.html">pNo_PK</a> obras, int tamanho)</td></tr>

</table>
<hr><h2>Definições e macros</h2>
<a class="anchor" name="188f1f2349eb5bc93fad6bfd21729574"></a><!-- doxytag: member="remove.h::FIM_AVAIL" ref="188f1f2349eb5bc93fad6bfd21729574" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define FIM_AVAIL&nbsp;&nbsp;&nbsp;-1          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

</div>
</div><p>
<hr><h2>Funções</h2>
<a class="anchor" name="81d2780fd2ab9f3eabe0faf2eeff5022"></a><!-- doxytag: member="remove.h::cria_avail" ref="81d2780fd2ab9f3eabe0faf2eeff5022" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cria_avail           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<div class="fragment"><pre class="fragment"><a name="l00005"></a>00005                    {
<a name="l00006"></a>00006         FILE * avail_head;
<a name="l00007"></a>00007         avail_head = fopen (<span class="stringliteral">"avail_head.dat"</span>, <span class="stringliteral">"w"</span>);
<a name="l00008"></a>00008         fprintf(avail_head, <span class="stringliteral">"%.3d"</span>,<a class="code" href="remove_8h.html#188f1f2349eb5bc93fad6bfd21729574">FIM_AVAIL</a>);
<a name="l00009"></a>00009         fclose(avail_head);
<a name="l00010"></a>00010 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="9bbf12ea3c272f4e62cf440eae0acb09"></a><!-- doxytag: member="remove.h::remocao" ref="9bbf12ea3c272f4e62cf440eae0acb09" args="(pNo_PK obras, int tamanho)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void remocao           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structNo__PK.html">pNo_PK</a>&nbsp;</td>
          <td class="paramname"> <em>obras</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>tamanho</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<div class="fragment"><pre class="fragment"><a name="l00013"></a>00013                                         {
<a name="l00014"></a>00014         
<a name="l00015"></a>00015                 FILE *avail_head;
<a name="l00016"></a>00016                 FILE *base;
<a name="l00017"></a>00017 
<a name="l00018"></a>00018                 <span class="keywordtype">char</span> aux[6], titulo[(<a class="code" href="consulta_8h.html#4e08e3da16a5821367047709c8f0f2a6">tam_titulo</a>)+1];
<a name="l00019"></a>00019         <span class="keywordtype">int</span> atual, i;
<a name="l00020"></a>00020         <a class="code" href="structNo__PK.html">pNo_PK</a> busca;
<a name="l00021"></a>00021 
<a name="l00022"></a>00022         __fpurge(stdin);
<a name="l00023"></a>00023         printf(<span class="stringliteral">"Digite o titulo da obra a ser removida: "</span>);
<a name="l00024"></a>00024         <a class="code" href="inserir_8c.html#ca633dc542efdd5fd5748989918dd125">remove_espacos</a>();
<a name="l00025"></a>00025         fgets(titulo, <a class="code" href="consulta_8h.html#4e08e3da16a5821367047709c8f0f2a6">tam_titulo</a>, stdin);
<a name="l00026"></a>00026         <a class="code" href="inserir_8c.html#a11e0d6e82a681b31792c378cdc4fbf4">completa_espacos</a>(titulo, <a class="code" href="consulta_8h.html#4e08e3da16a5821367047709c8f0f2a6">tam_titulo</a>);
<a name="l00027"></a>00027 
<a name="l00028"></a>00028         <span class="keywordflow">if</span>(busca = bsearch (titulo, obras, tamanho, <span class="keyword">sizeof</span> (<span class="keyword">struct</span> <a class="code" href="structNo__PK.html">No_PK</a>), <a class="code" href="consulta_8c.html#c3f135f977e97ce51bde811fe4850fb7">compara</a>)) {
<a name="l00029"></a>00029 
<a name="l00030"></a>00030                 <span class="comment">/* armazena na string aux o nrr do comeco da avail list */</span>
<a name="l00031"></a>00031                         avail_head = fopen(<span class="stringliteral">"avail_head.dat"</span>, <span class="stringliteral">"r+"</span>);
<a name="l00032"></a>00032                         fgets(aux, 5, avail_head);
<a name="l00033"></a>00033                         atoi(aux);
<a name="l00034"></a>00034                 
<a name="l00035"></a>00035                         <span class="comment">/* coloca o nrr do arquivo removido no comeco da avail list */</span>
<a name="l00036"></a>00036                         rewind(avail_head);
<a name="l00037"></a>00037                         fprintf(avail_head,<span class="stringliteral">"%.4d"</span>, busca-&gt;<a class="code" href="structNo__PK.html#8e709669c30740a3a8952ffdefa5bdf3">nrr</a>);
<a name="l00038"></a>00038                         fclose(avail_head);
<a name="l00039"></a>00039 
<a name="l00040"></a>00040                         <span class="comment">/* coloca o nrr que estava no comeco da avail list para o local do registro removido */</span>
<a name="l00041"></a>00041                         base = fopen(<span class="stringliteral">"base25.dat"</span>, <span class="stringliteral">"r+"</span>);
<a name="l00042"></a>00042                         atual = ((busca-&gt;<a class="code" href="structNo__PK.html#8e709669c30740a3a8952ffdefa5bdf3">nrr</a>) - 1) * <a class="code" href="consulta_8h.html#63e82776cfea43a18ab091e7d3a01b13">tam_total</a>;
<a name="l00043"></a>00043                         fseek(base, atual, SEEK_SET);
<a name="l00044"></a>00044                         fputs(aux, base);
<a name="l00045"></a>00045 
<a name="l00046"></a>00046                 fprintf(base, <span class="stringliteral">"*"</span>);
<a name="l00047"></a>00047                 <span class="keywordflow">for</span>(i=0; i&lt;(<a class="code" href="consulta_8h.html#63e82776cfea43a18ab091e7d3a01b13">tam_total</a>-5); i++) {
<a name="l00048"></a>00048                         fputs(<span class="stringliteral">" "</span>, base);
<a name="l00049"></a>00049                 }
<a name="l00050"></a>00050                 
<a name="l00051"></a>00051                         
<a name="l00052"></a>00052                         printf(<span class="stringliteral">"\nObra removida com sucesso!\n\n"</span>);
<a name="l00053"></a>00053                         
<a name="l00054"></a>00054                         fclose(base);
<a name="l00055"></a>00055         }
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 
<a name="l00058"></a>00058         <span class="keywordflow">else</span> {  
<a name="l00059"></a>00059                 printf(<span class="stringliteral">"\nNenhuma obra correspondente encontrada.\n\n"</span>);
<a name="l00060"></a>00060         }
<a name="l00061"></a>00061 
<a name="l00062"></a>00062 }
</pre></div>
<p>

<p>
<div class="dynheader">
Este é o grafo de chamadas para esta função:</div>
<div class="dynsection">
<p><center><img src="remove_8h_9bbf12ea3c272f4e62cf440eae0acb09_cgraph.png" border="0" usemap="#remove_8h_9bbf12ea3c272f4e62cf440eae0acb09_cgraph_map" alt=""></center>
<map name="remove_8h_9bbf12ea3c272f4e62cf440eae0acb09_cgraph_map">
<area shape="rect" href="consulta_8c.html#c3f135f977e97ce51bde811fe4850fb7" title="compara" alt="" coords="168,6,248,32"><area shape="rect" href="inserir_8c.html#a11e0d6e82a681b31792c378cdc4fbf4" title="completa_espacos" alt="" coords="135,56,281,83"><area shape="rect" href="inserir_8c.html#ca633dc542efdd5fd5748989918dd125" title="remove_espacos" alt="" coords="140,107,276,134"></map>
</div>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Gerado em Mon Apr 28 16:38:43 2008 para Catalago de Obras - Grupo 25 por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
</body>
</html>
